$('#user_center_save_submit').click(function(e) {
    e.preventDefault();
    var btn = $(this);
    var form = $(this).closest('form');

    form.validate({
        rules: {
            username: {
                required: true
            },
            department_name: {
                required: true
            },
            Email: {
                required: true,
                email: true
            },
            phone_number: {
                required: true,
                rangelength:[11,11]
            }
        },
        messages:{
            username:{
                required: "请输入真实姓名"
            },
            department_name:{
                required: "请输入单位名称"
            },
            Email:{
                required: "请输入电子邮箱地址",
                email: "邮箱格式不正确"
            },
            phone_number:{
                required: "请输入手机号",
                rangelength: "请输入11位有效手机号"
            }
        }
    });

    if (!form.valid()) {
        return;
    }

    btn.addClass('m-loader m-loader--right m-loader--light').attr('disabled', true);

    form.ajaxSubmit({
        url: '',
        success: function(response, status, xhr, $form) {
            // similate 2s delay
            setTimeout(function() {
                btn.removeClass('m-loader m-loader--right m-loader--light').attr('disabled', false);
                showErrorMsg(form, 'danger', 'Incorrect username or password. Please try again.');
            }, 2000);
        }
    });
});